<?php 
    include("header.php");
?>

<head>
    <title>Liga - Wijzig tabblad 'jeugd'</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="/assets/css/default.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        @import "/assets/js/dojo-release-1.1.0/dijit/themes/tundra/tundra.css";
        @import "/assets/js/dojo-release-1.1.0/dojo/resources/dojo.css"
    </style>
    
    <script type="text/javascript" src="/assets/js/dojo-release-1.1.0/dojo/dojo.js"
      djConfig="parseOnLoad: true"></script>
    
    <script type="text/javascript">
        dojo.require("dijit.form.Button");
        dojo.require("dijit.InlineEditBox");
        dojo.require("dijit.Editor");
        dojo.require("dijit._editor.plugins.AlwaysShowToolbar");
        dojo.require("dijit._editor.plugins.EnterKeyHandling");
        dojo.require("dijit._editor.plugins.TextColor");
        dojo.require("dijit._editor.plugins.LinkDialog");
        dojo.require("dijit._editor.plugins.EditorImageDialog");
        dojo.require("dojo.parser");
    </script>
    
    <script>
       function successCommand(data,ioArgs) {
           window.location = "/jeugd/jeugd.php";
           /*if (data.length) {
               dojo.byId('jeugdAlert').className='error';
               dojo.byId('jeugdAlert').innerHTML=data;
           } else {
               window.location = "/jeugd/jeugd.php";
           } */
       }       
       
       function errorCommand(data, ioArgs) {
           dojo.byId('jeugdAlert').className='error';
           dojo.byId('jeugdAlert').innerHTML=data+': uw wijzigingen zijn niet opgeslagen. Gelieve contact op te nemen met de webmaster.';
       }
    </script>

</head>

<?
    $connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);
    mysql_select_db(DB_CATALOG);
    $result = mysql_query("SELECT content FROM jeugd", $connect);
    $row = mysql_fetch_assoc($result);
    $content = $row['content'];    
?>

<?php
    setTabIndex(7);
    createPage("Liga - Jeugd");
    
    if ( isset($_SESSION['user']) == false ) {
        redirect("/jeugd/jeugd.php");
    }
    
    $user = $_SESSION['user'];
?>
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0" bgcolor="#FFFFFF">
    <tr>
        <td id="leftFiller" valign="top" height="100%" rowspan="3" bgcolor="#666666">
            <table border="0" cellpadding="0" cellspacing="0" height="100%" width="8px">
                <tr><td>&nbsp;</td></tr>
            </table>
        </td>
        <td id="header" valign="top" width="100%">
            <table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">
                <tr>
                    <td bgcolor="#666666" width="40%">
                        <?php include("inc_title.html"); ?>
                    </td>
                </tr>
            </table>
            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">
                <tr>
                    <?php include("inc_sublinks.php"); ?>   
                </tr>
                <tr><td colspan="3" nowrap bgcolor="#BCDD10" height="4"><img src="/assets/images/spacer.gif" alt="" height="1" width="1"></td></tr>
                <tr>
                    <td>&nbsp;</td>
                    <td width="90%" valign="top">
                        <br>
                        <span class="blackHeaderLarge">Jeugd</span>
                        &nbsp;&nbsp;
                        <span class="hidden" id="jeugdAlert"></span>
                        <form id="jeugdForm" method="post">
                            <div style="border: 1px solid #ccc" class="tundra">
                                <textarea id="jeugdEditor" dojoType="dijit.Editor" height="350"
                                    plugins="['undo', 'redo', 'cut', 'copy', 'paste',
                                    '|', 'bold','italic','underline','strikethrough','subscript', 'superscript', 'removeFormat',
                                    '|','indent', 'outdent','justifyCenter', 'justifyFull', 'justifyLeft', 'justifyRight', 'delete', 'selectall',
                                    '|','createLink','insertImage','foreColor','hiliteColor','insertOrderedList','insertUnorderedList', 'toggleDir']"
                                    styleSheets="/assets/js/dojo-release-1.1.0/dojo/resources/dojo.css">
                                    <?=$content?>
                                </textarea> 
                            </div>
                            <input type="hidden" id="jeugdContent" name="jeugdContent" />
                        </form>
                        <button dojoType="dijit.form.Button" id="submitButton2" class="tundra">
                            Wijzig
                            <script type="dojo/method" event="onClick">
                                dojo.byId('jeugdContent').value = dijit.byId('jeugdEditor').getValue();
                                dojo.xhrPost({
                                    url: '/jeugd/edit_jeugd.php',
                                    load: successCommand,
                                    error: errorCommand,
                                    form: 'jeugdForm'
                                });
                            </script>
                        </button>
                    </td>
                    <td width="5%">&nbsp;</td>
                </tr>
            </table>
        </td>
    </tr>
</table>

</body>
</html>
